import Vue from 'vue'
import App from './App.vue'
import store from '@/store'
import '@/utils/solution'
import '@/plugins'
import '@/assets/styles/common.scss'

//复制到粘贴板插件
import VueClipboard from 'vue-clipboard2'
VueClipboard.config.autoSetContainer = true
Vue.use(VueClipboard)

import BetterScroll from '@/components/better-scroll/index'
import {request} from "@/utils/request";
// 注册全局组件
Vue.component('BetterScroll', BetterScroll)

// 调试
// import Vconsole from 'vconsole'
// let vConsole = new Vconsole()
// export default vConsole

Vue.config.productionTip = false

if (process.env.NODE_ENV === 'production') {
    window.apiready = () => {
        new Vue({
            store,
            render: h => h(App)
        }).$mount('#app')
    }
} else {
    new Vue({
        store,
        render: h => h(App)
    }).$mount('#app')
}

//获取坯布信息
export function loadGreyCloth(data, callback) {
    return request({
        url: '/grey_cloth/pub',
        method: 'get',
        data,
        isYarn: true,
        isId: true
    }, callback);
}

// 织造工艺 根据任务ID
export function loadCraftByTask(data, callback) {
    return request({
        url: '/weaving_craft/pub',
        method: 'get',
        data,
        isYarn: true,
    }, callback);
}

// 获取单个织造工艺
export function loadCraftById(data, callBack) {
    return request({
        url: '/weaving_craft/pub',
        method: 'get',
        data,
        isYarn: true,
        isId: true
    }, callBack)
}

//织造工艺列表 根据设计
export function loadCraftByDesign(data, callback) {
    return request({
        url: '/weaving_craft/pub/list_craft',
        method: 'get',
        data,
        isYarn: true,
    }, callback);
}

// 流程环节列表
export function loadTaskStepList(data, callBack) {
    return request({
        url: '/task_step/pub/list_steps',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}

// 操作数据列表 根据环节
export function loadOptDataByStep(data, callBack) {
    return request({
        url: '/weaving_grey_cloth_data/pub/get_cur_by_step',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 坯布数据列表 根据织造单
export function loadGreyClothByCraft(data, callBack) {
    return request({
        url: '/grey_cloth/pub/list_by_craft',
        method: 'get',
        data,
        isYarn: true,
        isId: true
    }, callBack)
}